# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.AllocationAggregateReservation do
  @moduledoc """
  This reservation type is specified by total resource amounts (e.g. total count of CPUs) and can account for multiple instance SKUs. In other words, one can create instances of varying shapes against this reservation.

  ## Attributes

  *   `inUseResources` (*type:* `list(GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo.t)`, *default:* `nil`) - [Output only] List of resources currently in use.
  *   `reservedResources` (*type:* `list(GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo.t)`, *default:* `nil`) - List of reserved resources (CPUs, memory, accelerators).
  *   `vmFamily` (*type:* `String.t`, *default:* `nil`) - The VM family that all instances scheduled against this reservation must belong to.
  *   `workloadType` (*type:* `String.t`, *default:* `nil`) - The workload type of the instances that will target this reservation.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :inUseResources =>
            list(
              GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo.t()
            )
            | nil,
          :reservedResources =>
            list(
              GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo.t()
            )
            | nil,
          :vmFamily => String.t() | nil,
          :workloadType => String.t() | nil
        }

  field(:inUseResources,
    as: GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo,
    type: :list
  )

  field(:reservedResources,
    as: GoogleApi.Compute.V1.Model.AllocationAggregateReservationReservedResourceInfo,
    type: :list
  )

  field(:vmFamily)
  field(:workloadType)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.AllocationAggregateReservation do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.AllocationAggregateReservation.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.AllocationAggregateReservation do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
